#include "hal.h"
#include "buttons.h"

volatile uint8_t gButtonOnOff=0;
/**********************************************************************************
 * Descrição:
 *
 * Paramêtro(s):
 *					-
 * Retorno:
 *					-
 **********************************************************************************/
void buttons_init (void){
    FIO_SetDir(PORTBUTTON_ONOFF,BUTTON_ONOFF, 0);// define como saida
}

/**********************************************************************************
 * Descrição:
 *
 * Paramêtro(s):
 *					-
 * Retorno:
 *		Zero			-     Significa que a chave esta desligada
                  1                     -     Significa que esta ligado
 **********************************************************************************/

uint8_t  buttons_read (uint8_t button){
	static uint8_t ibutton;
        ibutton=(GPIO_ReadValue(PORTBUTTON_ONOFF)&(BUTTON_ONOFF));
	return ibutton;//zero significa que a esta desligado
}


/**********************************************************************************
 * Descrição:
 *
 * Paramêtro(s):
 *					-
 * Retorno:
 *					-
 **********************************************************************************/

void buttons_isr (void){
 static uint8_t rButtonNumber=0;

 buttons_read(rButtonNumber);

}
